package blaha.genalg.beans;

/**
 * Class represents one point on board. it has x and y axis and distance from
 * centre of board(same centre for circle of inner city).
 * 
 * @author uziv
 * 
 */
public class Point {
	public int x, y;
	float distanceFromcircumcentre;
	public int name;
	public boolean solitude;
	public boolean centre;

	/**
	 * Point always should come with int name represented by circle
	 * 
	 * @param pointName
	 */
	public Point(int pointName) {
		// TODO Auto-generated constructor stub
		this.name = pointName;
		this.solitude = true;
		this.centre = false;
	}

//	/**
//	 * name of the point
//	 * 
//	 * @return
//	 */
//	public int getName() {
//		return name;
//	}

	/**
	 * X position of point
	 * 
	 * @return
//	 */
//	public Integer getX() {
//		return x;
//	}

	public void setX(Integer x) {
		distanceFromcircumcentre = -1f;
		this.x = x;
	}

	/**
	 * Y position of point
	 * 
	 * @return
	 */
//	public Integer getY() {
//		return y;
//	}

	public void setY(Integer y) {
		distanceFromcircumcentre = -1f;
		this.y = y;
	}

	/**
	 * 
	 * @return distance of point from centre, if x or y is changed, its
	 *         recalculated
	 */
	public float getDistanceFromcircumcentre() {
		if (distanceFromcircumcentre > 0)
			return distanceFromcircumcentre;
		else {
			distanceFromcircumcentre = (float)Math.sqrt(x * x + y * y);
			return distanceFromcircumcentre;
		}
	}

//	public boolean isSolitude() {
//		return solitude;
//	}
//
//	public void setSolitude(boolean solitude) {
//		this.solitude = solitude;
//	}
//
//	/**
//	 * Indicate if point is in the center
//	 * @return
//	 */
//	public boolean isCentre() {
//		return centre;
//	}
//
//	public void setCentre(boolean centre) {
//		this.centre = centre;
//	}

}
